//
//  XMLTestAppDelegate.m
//  Bespoke
//
//  Created by Cheng on 12/7/6.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "XMLTestAppDelegate.h"
#import "HomePageViewController.h"
#import "PartyParser.h"
#import "Party.h"
#import "Player.h"

@implementation XMLTestAppDelegate

@synthesize window;
@synthesize viewController;
@synthesize party = _party;

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    
    self.party = [PartyParser loadParty];   
    
    if (_party != nil) {
        for (Player *player in _party.players) {
            NSLog(@"%d", player.text_id);
        }
        for (Player *player in _party.players) {
            NSLog(@"%@", player.text_title);
        }
        
        // Add a new party member, for fun
    }
    
    
    // Override point for customization after app launch    
    //[window addSubview:viewController.view];
    [window makeKeyAndVisible];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    
    [PartyParser saveParty:_party];
    
}

- (void)dealloc {
    self.party = nil;
    [viewController release];
    [window release];
    [super dealloc];
}

@end
